package com.zengqingfa.demo.config;

import com.zengqingfa.demo.listener.MyListener;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.EventListener;

/**
 * @author zengqingfa
 * @date 2019/11/22 11:10
 * @description
 * @email zengqingfa_java@163.com
 */
@Configuration
public class CustomerListenerConfig {

    /**
     * 注册监听器
     * @return
     */
    //@Bean
    public ServletListenerRegistrationBean myListener() {
        ServletListenerRegistrationBean<EventListener> servletListenerRegistrationBean =
                new ServletListenerRegistrationBean<>();
        servletListenerRegistrationBean.setListener(new MyListener());
        return servletListenerRegistrationBean;
    }
}
